package com.groovyscrum

class Sprint {

    Date dateCreated //automatically handled by Gorm
    Date startDate
    Date endDate
    static hasMany=[stories:Story]
    static belongsTo=Project
    static constraints = {
        startDate(nullable:false)
        endDate(nullable:false)
        endDate(validator: {val, obj ->
           if (val && val.before(obj.startDate))
           {
                return 'endDateGreaterThanStartDate'
           }
       })
    }
}
